#pragma once
#include <vector>
#include <string>
#include <fstream>
#include <iostream>

#define CRC8_POLYNOMIAL 0x07

using namespace std;

class DataToFile {
private:
    vector<unsigned char> rawData;
    vector<unsigned char> finalData;

    unsigned char calculateCRC8(const unsigned char* data, size_t length);
    bool verifyAndExtract();

public:
    DataToFile(const vector<unsigned char>& data);
    bool writeToFile(const string& filePath);
};